package behavioral_pattern.command_pattern;

import behavioral_pattern.command_pattern.test1.*;
import behavioral_pattern.command_pattern.test2.ConfigSettingWindow;
import behavioral_pattern.command_pattern.test2.Configurator;
import behavioral_pattern.command_pattern.test2.InsertCommand;

public class MainCommand {
    public static void main(String[] args) {
        FBSettingWindow fbSettingWindow = new FBSettingWindow("Mac");
       FunctionButton functionButton1 = new FunctionButton("功能键1");
       FunctionButton functionButton2 = new FunctionButton("功能键2");

       Command command1,command2;

       command1 = new HelpCommand();
       command2 = new MinimizeCommand();

       functionButton1.setCommand(command1);
       functionButton2.setCommand(command2);

       fbSettingWindow.addFunctionButton(functionButton1);
       fbSettingWindow.addFunctionButton(functionButton2);

       fbSettingWindow.disPlay();

       functionButton1.onClick();
       functionButton2.onClick();


        System.out.println("-------------------");


        ConfigSettingWindow settingWindow = new ConfigSettingWindow();

        behavioral_pattern.command_pattern.test2.Command command;
        Configurator configurator = new Configurator();

        //4次对配置文件的更改
        command = new InsertCommand("增加");
        command.setConfigurator(configurator);
        settingWindow.setCommand(command);
        settingWindow.call("网站首页");

        settingWindow.save();
        settingWindow.recover();



    }
}
